package 设计模式.flyweeight;

import java.util.HashMap;
import java.util.Map;

/**
 * @功能
 * 响应工厂
 * @创建时间 2020/5/3
 */
public class CheeseFlyWayFactory {
    private static Map<String,CheeseFlyWeight> map = new HashMap<>();
    public static CheeseFlyWeight getCheese(String color){
        if(map.get(color)!=null){
            return map.get(color);
        }else {
            CheeseFlyWeight cfw = new ConcreateChess(color);
            map.put(color,cfw);
            return cfw;
        }
    }
}
